<template>
  <el-dialog
    title="预览文章"
    :visible="showRoleDialog"
    width="60%"
    @close="btnCancel"
  >
    <!-- 主体区域 -->
    <div class="preview-box">
      <div class="preview-title">{{ formData.title }}</div>
      <div class="preview-nav">
        <span
          >{{ formData.createTime|parseTimeByString("{y}-{m}-{d} {h}:{i}:{s}") }}</span
        >
        <span>{{ formData.username }}</span>
        <span class="el-icon-view"></span>
        <span>{{ formData.visits }}</span>
      </div>
      <div class="preview-content" v-html="formData.articleBody"></div>
    </div>
  </el-dialog>
</template>

<script>
import { detail } from '../../api/hmmm/articles'
export default {
  name: '',
  props: {
      showRoleDialog: {
      type: Boolean,
      default: false
    },
  },
  components: {
  },
  data () {
    return {
      formData: {
      }
    }
  },
  created () {

  },
  methods: {
   async getVideoById(i) {
      const  {data} = await detail(i)
      this.formData = data
    },
      btnCancel() {
       this.formData = this.$options.data().formData
      this.$emit('update:showRoleDialog', false)
    },
  }
}
// lang="sass"

</script>
<style  scoped>
.preview-title {
  font-size: 25px;
  font-weight: 700;
  margin-bottom: 10px;
}
.preview-nav span {
  margin-right: 10px;
}

.preview-content {
  margin-top: 10px;
  padding: 10px;
  background-color: #f5f5f5;
  border-top: 1px dashed #ccc;
}
.preview-content .ql-align-center > img {
  width: 650px !important;
}
</style>
